import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *


class WindowClass(QWidget):
    def __init__(self):
        super(WindowClass, self).__init__()
        self.initUI()

    def initUI(self):
        self.setWindowTitle('Window')
        self.resize(1000, 800)

        layout = QVBoxLayout()
        self.cal = QCalendarWidget(self)
        self.cal.setMinimumDate(QDate(1988, 1, 1))
        self.cal.setMaximumDate(QDate(2088, 1, 1))

        self.cal.setGridVisible(True)
        self.cal.move(20, 20)
        self.cal.resize(400, 350)
        self.cal.setWindowTitle("日历")
        self.cal.clicked.connect(self.show_date)

        self.label = QLabel(self)
        self.label.resize(1000, 500)
        date = self.cal.selectedDate()
        self.label.setText(date.toString("yyyy-MM-dd dddd"))
        self.label.move(10, 400)

        self.buttonCancel = QPushButton('&Cancel')
        self.buttonCancel.clicked.connect(self.close)
        layout.addWidget(self.buttonCancel)

        self.setLayout(layout)

    def show_date(self, date):
        self.label.setText((date.toString("yyyy-MM-dd dddd")))


if __name__ == '__main__':
    app = QApplication(sys.argv)
    main = WindowClass()
    main.show()
    sys.exit(app.exec_())
